Optimal. Leaf size=181 \[ -\frac {d \left (a^2 (n+1)+b^2 n\right ) \sin (e+f x) (d \sec (e+f x))^{n-1} \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right )}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^n}{f (n+1)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.15, antiderivative size = 181, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {3788, 3772, 2643, 4046} \[ -\frac {d \left (a^2 (n+1)+b^2 n\right ) \sin (e+f x) (d \sec (e+f x))^{n-1} \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right )}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^n}{f (n+1)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2643
Rule 3772
Rule 3788
Rule 4046
Rubi steps
\begin {align*} \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx &=\frac {(2 a b) \int (d \sec (e+f x))^{1+n} \, dx}{d}+\int (d \sec (e+f x))^n \left (a^2+b^2 \sec ^2(e+f x)\right ) \, dx\\ &=\frac {b^2 (d \sec (e+f x))^n \tan (e+f x)}{f (1+n)}+\left (a^2+\frac {b^2 n}{1+n}\right ) \int (d \sec (e+f x))^n \, dx+\frac {\left (2 a b \left (\frac {\cos (e+f x)}{d}\right )^n (d \sec (e+f x))^n\right ) \int \left (\frac {\cos (e+f x)}{d}\right )^{-1-n} \, dx}{d}\\ &=\frac {2 a b \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) (d \sec (e+f x))^n \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 (d \sec (e+f x))^n \tan (e+f x)}{f (1+n)}+\left (\left (a^2+\frac {b^2 n}{1+n}\right ) \left (\frac {\cos (e+f x)}{d}\right )^n (d \sec (e+f x))^n\right ) \int \left (\frac {\cos (e+f x)}{d}\right )^{-n} \, dx\\ &=-\frac {\left (a^2+\frac {b^2 n}{1+n}\right ) \cos (e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right ) (d \sec (e+f x))^n \sin (e+f x)}{f (1-n) \sqrt {\sin ^2(e+f x)}}+\frac {2 a b \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) (d \sec (e+f x))^n \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 (d \sec (e+f x))^n \tan (e+f x)}{f (1+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.36, size = 171, normalized size = 0.94 \[ \frac {\sqrt {-\tan ^2(e+f x)} \csc (e+f x) \sec (e+f x) (d \sec (e+f x))^n \left (a^2 \left (n^2+3 n+2\right ) \cos ^2(e+f x) \, _2F_1\left (\frac {1}{2},\frac {n}{2};\frac {n+2}{2};\sec ^2(e+f x)\right )+b n \left (2 a (n+2) \cos (e+f x) \, _2F_1\left (\frac {1}{2},\frac {n+1}{2};\frac {n+3}{2};\sec ^2(e+f x)\right )+b (n+1) \, _2F_1\left (\frac {1}{2},\frac {n+2}{2};\frac {n+4}{2};\sec ^2(e+f x)\right )\right )\right )}{f n (n+1) (n+2)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [F] time = 0.50, size = 0, normalized size = 0.00 \[ {\rm integral}\left ({\left (b^{2} \sec \left (f x + e\right )^{2} + 2 \, a b \sec \left (f x + e\right ) + a^{2}\right )} \left (d \sec \left (f x + e\right )\right )^{n}, x\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (d \sec \left (f x + e\right )\right )^{n}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [F] time = 8.19, size = 0, normalized size = 0.00 \[ \int \left (d \sec \left (f x +e \right )\right )^{n} \left (a +b \sec \left (f x +e \right )\right )^{2}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (d \sec \left (f x + e\right )\right )^{n}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.01 \[ \int {\left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )}^2\,{\left (\frac {d}{\cos \left (e+f\,x\right )}\right )}^n \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (d \sec {\left (e + f x \right )}\right )^{n} \left (a + b \sec {\left (e + f x \right )}\right )^{2}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________